package com.ofek.orjsonserializer;

public enum StringUtils {
	;
	/**
	 * Escape the characters \ and " into \\ and \" 
	 * @param s
	 * 			the string to escape
	 * @return
	 * 			the string with the escapes
	 */
	public static String escapeString(final String s) {
		return s.replace("\\", "\\\\").replace("\"", "\\\"");
	}
	
	/**
	 * Convert a field name into a getter name by adding the prefix "get" and converting the
	 * first character to uppercase.
	 * For example, for the field name "xyz", will return "getXyz"
	 * @param s
	 * 			the field name
	 * @return
	 * 			the getter name
	 */
	public static String fieldToGetterName(final String s) {
		return "get" + String.valueOf(Character.toUpperCase(s.charAt(0))) + s.substring(1);
	}
}
